<?
// $file: control/inc/functions/category/CatsListRecurseMenu.php
/************************************************************/
/*                     WDLab CMS                            */
/*              < http://www.wdlab.ru >                     */
/************************************************************/
// Original Author	 : Morozov Valentin, WDLab Group 
// Author Website 	 : http://www.wdlab.ru/
// Author Email 	 : info@wdlab.ru
// License Type   	 : GPL: See /control/manual/GPL.txt; 
// License in russian: See /control/manual/GPL_ru.txt; 
// ------------------------------------------------------------------------- //

////   :
////       JavaScript 

function CatsListRecurseMenu($start = 0, $x = 0, $rname, $y)
{
GLOBAL $razdel;

	$Query="SELECT 
				`ID`, 
				`CatName`, 
				`parentID` 
			
			FROM `".prefix.$razdel[$rname]['tablename']."_cats` 
			
			WHERE parentID = \"".$start."\"
			ORDER BY corder
			";
	
	$do = mysql_query($Query);
	if (!empty($do)) {
	$did = mysql_fetch_assoc($do); 
	
	while ($did)
	{
	
				for($y=0;$y<$x;$y++){ 
					echo "&nbsp;&nbsp;";
				}
				echo "<a href=\"elements_list.php?rname=".$rname."&CatID=".$did['ID']."\">".$did['CatName']."</a><br>";
	
		///   
		if (cat_is_have_child ($did['ID'], $rname) == 1) CatsListRecurseMenu($did['ID'], $x+1, $rname, $y);

		$did = mysql_fetch_assoc($do);
	
	}//while
	}//if (!empty($do)) {
	
return $x--;
}

?>